package org.autumn.aqs;

import java.util.Random;
import java.util.concurrent.CountDownLatch;

public class GameStartTest {
    public static void main(String[] args) throws InterruptedException {

        Random random = new Random();
        CountDownLatch latch = new CountDownLatch(1);

        new Thread(() -> {
            String player = "";
            for (int i = 0; i <= 100; i++) {
                player = i + "%";
                try {
                    Thread.sleep(random.nextInt(100));
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.print("\r" + player);
            }
            latch.countDown();
        }, "t1").start();

        latch.await();

        System.out.println("\n game start ...");

    }
}
